import request from '@/utils/request'

// 登录
export function login(data) {
  return request({
    url: '/auth/login',
    headers: {
      isToken: false
    },
    method: 'post',
    data
  })
}

// 获取用户信息
export function getInfo() {
  return request({
    url: '/user/getInfo',
    method: 'get'
  })
}

// 新增用户
export function addUser(data) {
  return request({
    url: '/user',
    method: 'post',
    data
  })
}

// 获取用户列表
export function getUserList(queryParams) {
  return request({
    url: '/user/list',
    method: 'get',
    params: queryParams
  })
}

// 退出登录
export function logout() {
  return request({
    url: '/auth/logout',
    method: 'delete'
  })
}

// 删除用户
export function delUser(id) {
  return request({
    url: '/user/' + id,
    method: 'delete'
  })
}

// 更新用户
export function updateUser(data) {
  return request({
    url: '/user',
    method: 'put',
    data: data
  })
}
